home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-07-03 | 2.3 KB | 58 lines | [TEXT/R*ch] |
- (* Array2 -- as of 1995-04-22 *)
-
- eqtype 'a array2
-
- val maxLen : int
-
- val array : int * int * '_a -> '_a array2
- val tabulate : int * int * (int * int -> '_a) -> '_a array2
-
- val dim : 'a array2 -> int * int
- val sub : 'a array2 * int * int -> 'a
- val update : 'a array2 * int * int * 'a -> unit
- val extract1 : 'a array2 * int * int * int option -> 'a Vector.vector
- val extract2 : 'a array2 * int * int * int option -> 'a Vector.vector
-
- (* Type [ty array2] is the type of two-dimensional, mutable,
- zero-based constant-time-access arrays with elements of type ty.
- Type ty array admits equality even if ty does not. Arrays a1 and
- a2 are equal if both were created by the same call to a primitive,
- or if both are empty.
-
- [maxLen] is the maximal number of elements in one dimension of an array.
-
- [array(m, n, x)] returns a new m * n matrix whose elements are all x.
- Raises Size if n<0 or m<0 or n>maxLen or m>maxLen.
-
- [tabulate(m, n, f)] returns a new m-by-n array whose elements
- are f(0,0), f(0,1), ..., f(0, n-1),
- f(1,0), f(1,1), ..., f(1, n-1),
- ...
- f(m-1,0), ..., f(m-1, n-1)
- created in that order. Raises Size if n<0 or m<0 or n>maxLen or m>maxLen.
-
- [dim a] returns the dimensions (m, n) of a.
-
- [sub(a, i, j)] returns the i'th row's j'th element, counting from 0.
- Raises Subscript if i<0 or j<0 or i>=m or j>=n where (m,n) = dim a.
-
- [update(a, i, j, x)] destructively replaces the (i,j)'th element of a
- by x. Raises Subscript if i<0 or j<0 or i>=m or j>=n where (m,n) = dim a.
-
- [extract1(a, i, j, NONE)] returns a subrow of a: the vector
- containing the elements a[i][j..n-1] of a, where (m, n) = dim(a).
- Raises Subscript if i<0 or j<0 or i>=m or j>n.
-
- [extract1(a, i, j, SOME len)] returns a subrow of a: the vector
- containing the elements a[i][j..j+len-1] of a. Raises Subscript if
- i<0 or j<0 or i>=m or j+len>n where (m,n) = dim a.
-
- [extract2(a, i, j, NONE)] returns a subcolumn of a: the vector
- containing the elements a[i..m-1][j] of a where (m,n) = dim a.
- Raises Subscript if i<0 or j<0 or i>m or j>=n.
-
- [extract2(a, i, j, SOME len)] returns a subcolumn of a: the vector
- containing the elements a[i..i+len-1][j] of a. Raises Subscript if
- i<0 or j<0 or i+len>m or j>=n where (m,n) = dim a.
- *)
-